import request from '../request'
import type { ApiResponse, PaginationParams, PaginationResponse } from '../types'

export interface Feedback {
  id: number
  tenantId: number
  userId: number
  contact: string
  type: number
  content: string
  images: string[]
  status: number
  handlerId: number
  remark: string
}

// 获取反馈列表
export const getFeedbackList = (params?: PaginationParams) => {
  return request.post<ApiResponse<PaginationResponse<Feedback>>>('/admin/app/feedback/page', params)
}

// 获取反馈详情
export const getFeedbackInfo = (id: number) => {
  return request.get<ApiResponse<Feedback>>('/admin/app/feedback/info', { params: { id } })
}

// 添加反馈
export const addFeedback = (data: Omit<Feedback, 'id' | 'tenantId' | 'userId' | 'status' | 'handlerId'>) => {
  return request.post<ApiResponse>('/admin/app/feedback/add', data)
}

// 更新反馈
export const updateFeedback = (data: Partial<Feedback>) => {
  return request.post<ApiResponse>('/admin/app/feedback/update', data)
}

// 删除反馈
export const deleteFeedback = (id: number) => {
  return request.post<ApiResponse>('/admin/app/feedback/delete', { id })
} 